package cn.lsh.comparator;

import org.apache.hadoop.io.Text;
import org.apache.hadoop.io.WritableComparable;
import org.apache.hadoop.io.WritableComparator;

import java.util.StringTokenizer;

public class HotCommentGroup3Comparator extends WritableComparator {

	public HotCommentGroup3Comparator() {
		super(Text.class, true);
	}

	@Override
	public int compare(WritableComparable a, WritableComparable b) {
		StringTokenizer sta = new StringTokenizer(a.toString(), "_");
		StringTokenizer stb = new StringTokenizer(b.toString(), "_");
		return sta.nextToken().compareTo(stb.nextToken());
	}
}
